package com.xtrip.base;

import java.util.List;

import com.xtrip.adm.model.City;
import com.xtrip.common.BasicConstant;
import com.xtrip.util.IdGenerator;

public abstract class BaseService<T> {
	public abstract BaseDao<T> getDao() ;

	public List<T> find(T condition) {
		return getDao().find(condition);
	}

	public T load(Object id) {
		return getDao().load(id);
	}
	public List query(String sql , List params){
		return getDao().queryWithSql(sql, params);
	}
	public T insert(T entity) {
		getDao().insert(entity);
		return entity;
	}
	public boolean insertWithId(T entity){
		return getDao().insert(entity)==1;
	}
	public boolean update(T entity) {
		if (getDao().update(entity) > 0) {
			return true;
		}
		return false;
	}

	public int delete(T entity) {
		return getDao().delete(entity);
	}

	public int deleteById(Object id) {
		return getDao().deleteById(id);
	}
}
